Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
mon.c File Reference
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/slab.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/xprtsock.h>
#include <linux/sunrpc/svc.h>
#include <linux/lockd/lockd.h>
#include <asm/unaligned.h>
#include "netns.h"

Go to the source code of this file.

Data Structures

struct  nsm_args
 
struct  nsm_res
 

Macros

#define NLMDBG_FACILITY   NLMDBG_MONITOR
 
#define NSM_PROGRAM   100024
 
#define NSM_VERSION   1
 
#define SM_my_name_sz   (1+XDR_QUADLEN(SM_MAXSTRLEN))
 
#define SM_my_id_sz   (SM_my_name_sz+3)
 
#define SM_mon_name_sz   (1+XDR_QUADLEN(SM_MAXSTRLEN))
 
#define SM_mon_id_sz   (SM_mon_name_sz+SM_my_id_sz)
 
#define SM_priv_sz   (XDR_QUADLEN(SM_PRIV_SIZE))
 
#define SM_mon_sz   (SM_mon_id_sz+SM_priv_sz)
 
#define SM_monres_sz   2
 
#define SM_unmonres_sz   1
 

Enumerations

enum  {
  NSMPROC_NULL, NSMPROC_STAT, NSMPROC_MON, NSMPROC_UNMON,
  NSMPROC_UNMON_ALL, NSMPROC_SIMU_CRASH, NSMPROC_NOTIFY
}
 

Functions

int nsm_monitor (const struct nlm_host *host)
 
void nsm_unmonitor (const struct nlm_host *host)
 
struct nsm_handle * nsm_get_handle (const struct sockaddr *sap, const size_t salen, const char *hostname, const size_t hostname_len)
 
struct nsm_handle * nsm_reboot_lookup (const struct nlm_reboot *info)
 
void nsm_release (struct nsm_handle *nsm)
 

Variables

u32 __read_mostly nsm_local_state
 
bool __read_mostly nsm_use_hostnames
 

Macro Definition Documentation

#define NLMDBG_FACILITY   NLMDBG_MONITOR

Definition at line 23 of file mon.c.

#define NSM_PROGRAM   100024

Definition at line 24 of file mon.c.

#define NSM_VERSION   1

Definition at line 25 of file mon.c.

#define SM_mon_id_sz   (SM_mon_name_sz+SM_my_id_sz)

Definition at line 570 of file mon.c.

#define SM_mon_name_sz   (1+XDR_QUADLEN(SM_MAXSTRLEN))

Definition at line 569 of file mon.c.

#define SM_mon_sz   (SM_mon_id_sz+SM_priv_sz)

Definition at line 572 of file mon.c.

#define SM_monres_sz   2

Definition at line 573 of file mon.c.

#define SM_my_id_sz   (SM_my_name_sz+3)

Definition at line 568 of file mon.c.

#define SM_my_name_sz   (1+XDR_QUADLEN(SM_MAXSTRLEN))

Definition at line 567 of file mon.c.

#define SM_priv_sz   (XDR_QUADLEN(SM_PRIV_SIZE))

Definition at line 571 of file mon.c.

#define SM_unmonres_sz   1

Definition at line 574 of file mon.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
NSMPROC_NULL 
NSMPROC_STAT 
NSMPROC_MON 
NSMPROC_UNMON 
NSMPROC_UNMON_ALL 
NSMPROC_SIMU_CRASH 
NSMPROC_NOTIFY 

Definition at line 27 of file mon.c.

Function Documentation

struct nsm_handle* nsm_get_handle ( const struct sockaddr sap,
const size_t  salen,
const char hostname,
const size_t  hostname_len 
)
read

nsm_get_handle - Find or create a cached nsm_handle : pointer to socket address of handle to find : length of socket address : pointer to C string containing hostname to find : length of C string

Behavior is modulated by the global nsm_use_hostnames variable.

Returns a cached nsm_handle after bumping its ref count, or returns a fresh nsm_handle if a handle that matches and/or cannot be found in the handle cache. Returns NULL if an error occurs.

Definition at line 360 of file mon.c.

int nsm_monitor ( const struct nlm_host *  host)

nsm_monitor - Notify a peer in case we reboot : pointer to nlm_host of peer to notify

If this peer is not already monitored, this function sends an upcall to the local rpc.statd to record the name/address of the peer to notify in case we reboot.

Returns zero if the peer is monitored by the local rpc.statd; otherwise a negative errno value is returned.

Definition at line 182 of file mon.c.

struct nsm_handle* nsm_reboot_lookup ( const struct nlm_reboot info)
read

nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle : pointer to NLMPROC_SM_NOTIFY arguments

Returns a matching nsm_handle if found in the nsm cache. The returned nsm_handle's reference count is bumped. Otherwise returns NULL if some error occurred.

Definition at line 418 of file mon.c.

void nsm_release ( struct nsm_handle *  nsm)

nsm_release - Release an NSM handle : pointer to handle to be released

Definition at line 446 of file mon.c.

void nsm_unmonitor ( const struct nlm_host *  host)

nsm_unmonitor - Unregister peer notification : pointer to nlm_host of peer to stop monitoring

If this peer is monitored, this function sends an upcall to tell the local rpc.statd not to send this peer a notification when we reboot.

Definition at line 232 of file mon.c.

Variable Documentation

u32 __read_mostly nsm_local_state

Definition at line 59 of file mon.c.

bool __read_mostly nsm_use_hostnames

Definition at line 60 of file mon.c.