Lines Matching refs:parent

55     .parent      = &g_procRootDirEntry,
71 static struct ProcDirEntry *ProcFindNode(struct ProcDirEntry *parent, const char *name)
76 if ((parent == NULL) || (name == NULL)) {
81 for (pn = parent->subdir; pn != NULL; pn = pn->next) {
167 static int CheckProcName(const char *name, struct ProcDirEntry **parent, const char **lastName)
169 struct ProcDirEntry *pn = *parent;
197 *parent = pn;
203 static struct ProcDirEntry *ProcAllocNode(struct ProcDirEntry **parent, const char *name, mode_t mode)
213 if (CheckProcName(name, parent, &lastName) != 0) {
221 if ((S_ISDIR((*parent)->mode) == 0) || (strchr(lastName, '/'))) {
262 static int ProcAddNode(struct ProcDirEntry *parent, struct ProcDirEntry *pn)
266 if (parent == NULL) {
267 PRINT_ERR("%s(): parent is NULL", __FUNCTION__);
271 if (pn->parent != NULL) {
272 PRINT_ERR("%s(): node already has a parent", __FUNCTION__);
276 if (S_ISDIR(parent->mode) == 0) {
277 PRINT_ERR("%s(): parent is not a directory", __FUNCTION__);
283 temp = ProcFindNode(parent, pn->name);
285 PRINT_ERR("Error!ProcDirEntry '%s/%s' already registered\n", parent->name, pn->name);
290 pn->parent = parent;
291 pn->next = parent->subdir;
292 parent->subdir = pn;
301 struct ProcDirEntry *parent = pn->parent;
304 if (parent == NULL) {
305 PRINT_ERR("%s(): node has no parent", __FUNCTION__);
309 iter = &parent->subdir;
317 pn->parent = NULL;
320 static struct ProcDirEntry *ProcCreateDir(struct ProcDirEntry *parent, const char *name,
326 pn = ProcAllocNode(&parent, name, S_IFDIR | mode);
332 ret = ProcAddNode(parent, pn);
342 static struct ProcDirEntry *ProcCreateFile(struct ProcDirEntry *parent, const char *name,
348 pn = ProcAllocNode(&parent, name, S_IFREG | mode);
360 ret = ProcAddNode(parent, pn);
370 struct ProcDirEntry *CreateProcEntry(const char *name, mode_t mode, struct ProcDirEntry *parent)
375 pde = ProcCreateDir(parent, name, NULL, mode);
377 pde = ProcCreateFile(parent, name, NULL, mode);
438 void RemoveProcEntry(const char *name, struct ProcDirEntry *parent)
447 if (CheckProcName(name, &parent, &lastName) != 0) {
453 pn = ProcFindNode(parent, lastName);
470 struct ProcDirEntry *ProcMkdirMode(const char *name, mode_t mode, struct ProcDirEntry *parent)
472 return ProcCreateDir(parent, name, NULL, mode);
475 struct ProcDirEntry *ProcMkdir(const char *name, struct ProcDirEntry *parent)
477 return ProcCreateDir(parent, name, NULL, 0);
480 struct ProcDirEntry *ProcCreateData(const char *name, mode_t mode, struct ProcDirEntry *parent,
483 struct ProcDirEntry *pde = CreateProcEntry(name, mode, parent);
496 struct ProcDirEntry *ProcCreate(const char *name, mode_t mode, struct ProcDirEntry *parent,
499 return ProcCreateData(name, mode, parent, procFileOps, NULL);
716 if (pde->parent == NULL) {