~ubuntu-branches/ubuntu/quantal/aufs/quantal

« back to all changes in this revision

Viewing changes to util/auplink

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-04-01 18:26:37 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080401182637-ujuqq47eiggw4y5w
Tags: 0+20080401-1
* New upstream snapshot
  - Remove bashisms in script (Closes: #471288)
* debian/conf.mk, linux-patch-aufs.kpatches.sysfs_get_dentry:
  - Remove support for this patch, no longer used
* debian/conf.mk:
  - Add hacks for arm to armel (Closes: #473767)
* debian/control:
  - Add Dm-Upload-Allowed
* debian/copyright:
  - Use http://wiki.debian.org/Proposals/CopyrightFormat
* debian/linux-patch-aufs.kpatches.{splice,put_filp}:
  - Add support for Kernel 2.6.24 (and 2.6.25)
* debian/patches:
  - 01_vserver_apparmor: Update patch
  - 06_rt: Add patch for realtime kernel
  - 07_splice_hack: Add hack to support splice operations (Closes: #473430)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# Copyright (C) 2006, 2007 Junjiro Okajima
 
3
# Copyright (C) 2006, 2007, 2008 Junjiro Okajima
4
4
#
5
5
# This program, aufs is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 
19
 
# $Id: auplink,v 1.6 2007/04/16 01:19:49 sfjro Exp $
 
19
# $Id: auplink,v 1.9 2008/03/31 07:44:10 sfjro Exp $
20
20
 
21
21
#set -x
22
22
tmp=/tmp/$$
37
37
 
38
38
Find() # dir [ find_args ]
39
39
{
40
 
        local dir="$1"
 
40
        dir="$1"
41
41
        shift
42
42
        find "$dir" -xdev -noleaf $@
43
43
}
45
45
List()
46
46
{
47
47
        sed -e 's/^\([0-9]*\) .*$/-o -inum \1/' |
48
 
        xargs > $tmp.args
49
 
        Find "$mntpnt" \( `cut -c3- $tmp.args` \) $@
 
48
        cut -c3- |
 
49
        xargs -n 200 |
 
50
        while read args
 
51
        do Find "$mntpnt" \( $args \) $@
 
52
        done
50
53
}
51
54
 
52
55
Cpup()
80
83
cpup|flush) test $do_flush -eq 0 && exit 0;;
81
84
esac
82
85
 
83
 
brs=/sys/fs/aufs/brs
84
 
if [ -r $brs ]
 
86
sbi=/sys/fs/aufs/sbi
 
87
sbi_dir=
 
88
if [ -r $sbi ]
85
89
then
86
 
        grep " $mntpnt " $brs |
87
 
        tail -n 1 |
88
 
        tr '[, ]' '\n'
 
90
        # pay attention to the order in $sbi
 
91
        for id in $(cat $sbi)
 
92
        do
 
93
                d=/sys/fs/aufs/sbi_$id
 
94
                grep -q "^$mntpnt$" $d/mntpnt1 &&
 
95
                sbi_dir=$d &&
 
96
                break
 
97
        done
 
98
        test "$sbi_dir" -a -r $sbi_dir/br0 &&
 
99
        {
 
100
                cd $sbi_dir
 
101
                ls -1 br* |
 
102
                cut -c3- |
 
103
                sort -n |
 
104
                sed -e 's/^/br/' |
 
105
                xargs -rn 200 cat
 
106
                cd $OLDPWD
 
107
        }
89
108
else
90
109
        grep " $mntpnt " /proc/mounts |
91
110
        tail -n 1 |
92
 
        tr ',' '\n'
 
111
        tr ',' '\n' |
 
112
        sed -e 's/\\/\\\\/g' |
 
113
        egrep '^(dirs=|br:)' |
 
114
        tr ':' '\n'
93
115
fi |
94
 
sed -e 's/\\/\\\\/g' |
95
 
egrep '^(dirs=|br:)' |
96
 
tr ':' '\n' |
97
116
grep '=rw$' |
98
117
sed -e 's/=rw$//' |
99
118
while read wbr
107
126
        inum=`basename "$pname" | cut -f1 -d.`
108
127
        echo $inum $nlink "$pname"
109
128
done > $tmp
110
 
test -w $brs && >> $brs
111
129
test -s $tmp || { rm -f $tmp $tmp.*; exit 0; }
112
130
 
113
131
# debug