[BACK]Return to DirEntry.c++ CVS log [TXT][DIR] Up to [Development] / fam / fam

Annotation of fam/fam/DirEntry.c++, Revision 1.1

1.1     ! trev        1: //  Copyright (C) 1999 Silicon Graphics, Inc.  All Rights Reserved.
        !             2: //
        !             3: //  This program is free software; you can redistribute it and/or modify it
        !             4: //  under the terms of version 2 of the GNU General Public License as
        !             5: //  published by the Free Software Foundation.
        !             6: //
        !             7: //  This program is distributed in the hope that it would be useful, but
        !             8: //  WITHOUT ANY WARRANTY; without even the implied warranty of
        !             9: //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  Further, any
        !            10: //  license provided herein, whether implied or otherwise, is limited to
        !            11: //  this program in accordance with the express provisions of the GNU
        !            12: //  General Public License.  Patent licenses, if any, provided herein do not
        !            13: //  apply to combinations of this program with other product or programs, or
        !            14: //  any other product whatsoever.  This program is distributed without any
        !            15: //  warranty that the program is delivered free of the rightful claim of any
        !            16: //  third person by way of infringement or the like.  See the GNU General
        !            17: //  Public License for more details.
        !            18: //
        !            19: //  You should have received a copy of the GNU General Public License along
        !            20: //  with this program; if not, write the Free Software Foundation, Inc., 59
        !            21: //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
        !            22:
        !            23: #include "DirEntry.h"
        !            24:
        !            25: #include <assert.h>
        !            26: #include <stdio.h>
        !            27: #include <sys/param.h>
        !            28:
        !            29: #include "Directory.h"
        !            30:
        !            31: // A DirEntry may be polled iff its parent is not polled.
        !            32:
        !            33: DirEntry::DirEntry(const char *name, Directory *p, DirEntry *nx)
        !            34:     : Interest(name, p->filesystem(), p->host(), NO_VERIFY_EXPORTED),
        !            35:       parent(p), next(nx), need_to_chdir(true)
        !            36: { }
        !            37:
        !            38: DirEntry::~DirEntry()
        !            39: {
        !            40:     unscan();
        !            41: }
        !            42:
        !            43: bool
        !            44: DirEntry::active() const
        !            45: {
        !            46:     return parent->active();
        !            47: }
        !            48:
        !            49: void
        !            50: DirEntry::post_event(const Event& event, const char *eventpath)
        !            51: {
        !            52:     assert(!eventpath);
        !            53:     parent->post_event(event, name());
        !            54: }
        !            55:
        !            56: bool
        !            57: DirEntry::scan(Interest *ip)
        !            58: {
        !            59:     assert(!ip);
        !            60:     return parent->scan(this);
        !            61: }
        !            62:
        !            63: void
        !            64: DirEntry::scan_no_chdir()
        !            65: {
        !            66:     need_to_chdir = false;
        !            67:     parent->scan(this);
        !            68:     need_to_chdir = true;
        !            69:
        !            70: }
        !            71:
        !            72: void
        !            73: DirEntry::unscan(Interest *ip)
        !            74: {
        !            75:     assert(!ip);
        !            76:     parent->unscan(this);
        !            77: }
        !            78:
        !            79: bool
        !            80: DirEntry::do_scan()
        !            81: {
        !            82:     bool changed = false;
        !            83:     if (needs_scan() && active()) {
        !            84:         if (need_to_chdir) {
        !            85:             parent->become_user();
        !            86:             if (!parent->chdir()) {
        !            87:                 return false;
        !            88:             }
        !            89:         }
        !            90:         changed = Interest::do_scan();
        !            91:         if (need_to_chdir) {
        !            92:             parent->chdir_root();
        !            93:         }
        !            94:     }
        !            95:     return changed;
        !            96: }
        !            97:
        !            98: void
        !            99: DirEntry::notify_created(Interest *ip)
        !           100: {
        !           101:     assert(ip == this);
        !           102:     parent->notify_created(ip);
        !           103: }
        !           104:
        !           105: void
        !           106: DirEntry::notify_deleted(Interest *ip)
        !           107: {
        !           108:     assert(ip == this);
        !           109:     parent->notify_deleted(ip);
        !           110: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>