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

Annotation of fam/fam/FileSystem.c++, Revision 1.1.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 "FileSystem.h"
                     24:
                     25: #include <mntent.h>
                     26: #include <string.h>
                     27:
                     28: #include "Event.h"
                     29:
                     30: FileSystem::FileSystem(const mntent& mnt)
                     31:     : mydir   (strcpy(new char[strlen(mnt.mnt_dir   ) + 1], mnt.mnt_dir   )),
                     32:       myfsname(strcpy(new char[strlen(mnt.mnt_fsname) + 1], mnt.mnt_fsname))
                     33: { }
                     34:
                     35: FileSystem::~FileSystem()
                     36: {
                     37:     assert(!myinterests.size());
                     38:     delete [] mydir;
                     39:     delete [] myfsname;
                     40: }
                     41:
                     42: bool
                     43: FileSystem::matches(const mntent& mnt) const
                     44: {
                     45:     return !strcmp(mydir, mnt.mnt_dir) && !strcmp(myfsname, mnt.mnt_fsname);
                     46: }
                     47:
                     48: void
                     49: FileSystem::relocate_interests()
                     50: {
                     51:     for (ClientInterest *cip = myinterests.first();
                     52: 	 cip;
                     53: 	 cip = myinterests.next(cip))
                     54:     {
                     55: 	cip->findfilesystem();
                     56:     }
                     57: }
                     58:
                     59: Request
                     60: FileSystem::monitor(ClientInterest *cip, ClientInterest::Type type)
                     61: {
                     62:     myinterests.insert(cip);
                     63:     return hl_monitor(cip, type);
                     64: }
                     65:
                     66: void
                     67: FileSystem::cancel(ClientInterest *cip, Request request)
                     68: {
                     69:     hl_cancel(request);
                     70:     myinterests.remove(cip);
                     71: }

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