direntry_t *direntry_new_root (CALLER_DECL_ONLY) { direntry_t *de = (direntry_t *)calloc(1, sizeof(direntry_t)); /* Set the link count to something non-0. We can't query this from the * indexnode. We could work it out every time, but that would be tedious. * It turns out to be vitally important that this is non-0 if samba is going * to share the filesystem */ //TODO: calculate me in the future, or get best guess (i.e. the cache might //know, else 1) //FIXME: this is going to break. How do you list this direntry with a null //indexnode? There must be special-case code. BASE_CLASS(de)->name = strdup( "" ); BASE_CLASS(de)->type = listing_type_DIRECTORY; BASE_CLASS(de)->link_count = 1; de->inode = FSFUSE_ROOT_INODE; inode_map_add(de); direntry_trace( "[direntry %p inode %lu] new (" CALLER_FORMAT ") ref %u\n", de, de->inode, CALLER_PASS 1 ); return de; }
///////////////////////////////////////////////////////////////// // CContainerBase::CContainerBase // ///////////////////////////////////////////////////////////////// CContainerBase::CContainerBase(SOURCE eObjectType, CMainWindow* pCMainWindow, CMDIChild* pCMDIChild) : CBase(eObjectType, pCMainWindow, pCMDIChild) { //eBaseClass m_eBaseClass = BASE_CLASS(m_eBaseClass | eCContainerBase); //Common OLE DB Interfaces m_pIConnectionPointContainer = NULL; }
///////////////////////////////////////////////////////////////// // CPropertiesBase::CPropertiesBase // ///////////////////////////////////////////////////////////////// CPropertiesBase::CPropertiesBase(SOURCE eObjectType, CMainWindow* pCMainWindow, CMDIChild* pCMDIChild) : CAsynchBase(eObjectType, pCMainWindow, pCMDIChild) { //eBaseClass m_eBaseClass = BASE_CLASS(m_eBaseClass | eCPropertiesBase); //OLE DB Interfaces m_pIDBProperties = NULL; //OLE DB interface }
void direntry_delete (CALLER_DECL direntry_t *de) { unsigned refc = ref_count_dec( BASE_CLASS(de)->ref_count ); direntry_trace("[direntry %p inode %lu] delete (" CALLER_FORMAT ") ref %u\n", de, de->inode, CALLER_PASS refc); direntry_trace_indent(); if (!refc) { direntry_trace("refcount == 0 => free()ing\n"); listing_teardown(BASE_CLASS(de)); free(de); } direntry_trace_dedent(); }
direntry_t *direntry_copy (CALLER_DECL direntry_t *de) { unsigned refc = ref_count_inc( BASE_CLASS(de)->ref_count ); NOT_USED(refc); direntry_trace("[direntry %p inode %lu] copy (" CALLER_FORMAT ") ref %u\n", de, de->inode, CALLER_PASS refc); return de; }
int direntry_ensure_children ( direntry_t *de ) { int rc = EIO; const char *path; direntry_t *dirents = NULL; entry_found_ctxt_t *ctxt; if (!de->looked_for_children) { path = direntry_get_path(de); direntry_trace("direntry_get_children(%s)\n", path); ctxt = malloc( sizeof(*ctxt) ); ctxt->in = BASE_CLASS(de)->in; ctxt->lis = listing_list_new( 0 ); ctxt->i = 0; /* skip the leading '/' from the path that fuse gives us */ if (indexnode_tryget_listing(indexnode_copy(CALLER_INFO BASE_CLASS(de)->in), path + 1, &entry_found, ctxt)) { dirents = direntries_from_listing_list (ctxt->lis, de); rc = 0; listing_list_delete(CALLER_INFO ctxt->lis); } de->children = dirents; de->looked_for_children = 1; } return rc; }
///////////////////////////////////////////////////////////////// // CAsynchBase::CAsynchBase // ///////////////////////////////////////////////////////////////// CAsynchBase::CAsynchBase(SOURCE eObjectType, CMainWindow* pCMainWindow, CMDIChild* pCMDIChild) : CContainerBase(eObjectType, pCMainWindow, pCMDIChild) { //eBaseClass m_eBaseClass = BASE_CLASS(m_eBaseClass | eCAsynchBase); //OLE DB Interfaces m_pIDBInitialize = NULL; //OLE DB interface m_pIDBAsynchStatus = NULL; //OLE DB interface //Extra interfaces m_dwCookieAsynchNotify = 0; //Data m_fInitialized = FALSE; }
void direntry_de2stat (direntry_t *de, struct stat *st) { listing_li2stat(BASE_CLASS(de), st); st->st_ino = de->inode; }
char *direntry_get_href (direntry_t *de) { return listing_get_href(BASE_CLASS(de)); }
unsigned long direntry_get_link_count (direntry_t *de) { return listing_get_link_count(BASE_CLASS(de)); }
off_t direntry_get_size (direntry_t *de) { return listing_get_size(BASE_CLASS(de)); }
listing_type_t direntry_get_type (direntry_t *de) { return listing_get_type(BASE_CLASS(de)); }
char *direntry_get_name (direntry_t *de) { return listing_get_name(BASE_CLASS(de)); }
int direntry_equal (direntry_t *de, direntry_t *other) { return listing_equal(BASE_CLASS(de), BASE_CLASS(other)); }