]> git.saurik.com Git - apple/xnu.git/blame - bsd/hfs/hfs_notification.c
xnu-792.25.20.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_notification.c
CommitLineData
55e303ae
A
1/*
2 * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
3 *
6601e61a 4 * @APPLE_LICENSE_HEADER_START@
55e303ae 5 *
6601e61a
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
8f6c56a5 11 *
6601e61a
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
6601e61a
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
8f6c56a5 19 *
6601e61a 20 * @APPLE_LICENSE_HEADER_END@
55e303ae
A
21 */
22
23#include <sys/systm.h>
24#include <sys/kernel.h>
25#include <sys/file.h>
26#include <sys/dirent.h>
27#include <sys/stat.h>
55e303ae
A
28#include <sys/mount.h>
29#include <sys/vnode.h>
30#include <sys/malloc.h>
55e303ae
A
31#include <sys/ubc.h>
32#include <sys/quota.h>
33
34#include <sys/kdebug.h>
35
36#include "hfs.h"
37#include "hfs_catalog.h"
38#include "hfs_cnode.h"
55e303ae
A
39#include "hfs_dbg.h"
40#include "hfs_mount.h"
41#include "hfs_quota.h"
42#include "hfs_endian.h"
43
44#include "hfscommon/headers/BTreesInternal.h"
45#include "hfscommon/headers/FileMgrInternal.h"
46
47
48
49void hfs_generate_volume_notifications(struct hfsmount *hfsmp) {
50 ExtendedVCB *vcb = HFSTOVCB(hfsmp);
91447636
A
51 fsid_t fsid;
52
53 fsid.val[0] = (long)hfsmp->hfs_raw_dev;
54 fsid.val[1] = (long)vfs_typenum(HFSTOVFS(hfsmp));
55e303ae
A
55
56 if (hfsmp->hfs_notification_conditions & VQ_LOWDISK) {
57 /* Check to see whether the free space is back above the minimal level: */
58 if (hfs_freeblks(hfsmp, 1) > hfsmp->hfs_freespace_notify_desiredlevel) {
59 hfsmp->hfs_notification_conditions &= ~VQ_LOWDISK;
91447636 60 vfs_event_signal(&fsid, hfsmp->hfs_notification_conditions, NULL);
55e303ae
A
61 }
62 } else {
63 /* Check to see whether the free space fell below the requested limit: */
64 if (hfs_freeblks(hfsmp, 1) < hfsmp->hfs_freespace_notify_warninglimit) {
65 hfsmp->hfs_notification_conditions |= VQ_LOWDISK;
91447636 66 vfs_event_signal(&fsid, hfsmp->hfs_notification_conditions, NULL);
55e303ae
A
67 }
68 };
69}