/* * ----------------------------------------------------------------- * cfsd_fscache_create * * Description: * Arguments: * name * cachepath * Returns: * Preconditions: * precond(name) * precond(cachepath) */ cfsd_fscache_object_t * cfsd_fscache_create(const char *name, const char *cachepath, int fscacheid) { cfsd_fscache_object_t *fscache_object_p; int xx; dbug_enter("cfsd_fscache_create"); dbug_precond(name); dbug_precond(cachepath); fscache_object_p = cfsd_calloc(sizeof (cfsd_fscache_object_t)); strlcpy(fscache_object_p->i_name, name, sizeof (fscache_object_p->i_name)); strlcpy(fscache_object_p->i_cachepath, cachepath, sizeof (fscache_object_p->i_cachepath)); fscache_object_p->i_fscacheid = fscacheid; fscache_object_p->i_refcnt = 0; fscache_object_p->i_disconnectable = 0; fscache_object_p->i_mounted = 0; fscache_object_p->i_threaded = 0; fscache_object_p->i_connected = 0; fscache_object_p->i_reconcile = 0; fscache_object_p->i_changes = 0; fscache_object_p->i_simdis = 0; fscache_object_p->i_tryunmount = 0; fscache_object_p->i_backunmount = 0; fscache_object_p->i_time_state = 0; fscache_object_p->i_time_mnt = 0; fscache_object_p->i_modify = 1; fscache_object_p->i_threadid = 0; fscache_object_p->i_ofd = -1; fscache_object_p->i_next = NULL; /* initialize the locking mutex */ xx = mutex_init(&fscache_object_p->i_lock, USYNC_THREAD, NULL); dbug_assert(xx == 0); xx = cond_init(&fscache_object_p->i_cvwait, USYNC_THREAD, 0); dbug_assert(xx == 0); dbug_leave("cfsd_fscache_create"); return (fscache_object_p); }
/* * ------------------------------------------------------------ * cfsd_all_create * * Description: * Arguments: * Returns: * Preconditions: */ cfsd_all_object_t * cfsd_all_create(void) { /* get the host name */ struct utsname info; cfsd_all_object_t *all_object_p; int xx; char buffer[MAXPATHLEN]; dbug_enter("cfsd_all_create"); all_object_p = (cfsd_all_object_t *)cfsd_calloc(sizeof (cfsd_all_object_t)); xx = uname(&info); if (xx == -1) { dbug_print(("error", "cannot get host name")); strlcpy(all_object_p->i_machname, gettext("unknown"), sizeof (all_object_p->i_machname)); } else { strlcpy(all_object_p->i_machname, info.nodename, sizeof (all_object_p->i_machname)); } /* initialize the locking mutex */ xx = mutex_init(&all_object_p->i_lock, USYNC_THREAD, NULL); dbug_assert(xx == 0); all_object_p->i_nextcacheid = 0; all_object_p->i_modify = 1; all_object_p->i_cachelist = NULL; all_object_p->i_cachecount = 0; /* all_object_p->i_hoardp = NULL; */ snprintf(buffer, sizeof (buffer), gettext("host name is \"%s\""), all_object_p->i_machname); dbug_print(("info", buffer)); dbug_leave("cfsd_all_create"); return (all_object_p); }
/* * cfsd_logfile_create * * Description: * Arguments: * Returns: * Preconditions: */ cfsd_logfile_object_t * cfsd_logfile_create(void) { cfsd_logfile_object_t *logfile_object_p; dbug_enter("cfsd_logfile_create"); logfile_object_p = cfsd_calloc(sizeof (cfsd_logfile_object_t)); logfile_object_p->i_fid = -1; logfile_object_p->i_map_entry.i_pa = NULL; logfile_object_p->i_map_entry.i_paoff = 0; logfile_object_p->i_map_entry.i_paend = 0; logfile_object_p->i_map_entry.i_palen = 0; logfile_object_p->i_map_offset.i_pa = NULL; logfile_object_p->i_map_offset.i_paoff = 0; logfile_object_p->i_map_offset.i_paend = 0; logfile_object_p->i_map_offset.i_palen = 0; logfile_object_p->i_cur_offset = 0; logfile_object_p->i_cur_entry = NULL; dbug_leave("cfsd_logfile_create"); return (logfile_object_p); }