what does mm/swap_state.c:swap_count() return?

afei@jhu.edu
Sun, 14 Nov 1999 14:19:09 -0500 (EST)


it is appreciated that you send your reply to my email address.
134 int swap_count(unsigned long entry)
135 {
136 struct swap_info_struct * p;
137 unsigned long offset, type;
138 int retval = 0;
139
140 if (!entry)
141 goto bad_entry;
142 type = SWP_TYPE(entry);
143 if (type & SHM_SWP_TYPE)
144 goto out;
145 if (type >= nr_swapfiles)
146 goto bad_file;
147 p = type + swap_info;
148 offset = SWP_OFFSET(entry);
149 if (offset >= p->max)
150 goto bad_offset;
151 if (!p->swap_map[offset])
152 goto bad_unused;
153 retval = p->swap_map[offset];
154 #ifdef DEBUG_SWAP
155 printk("DebugVM: swap_count(entry %08lx, count %d)\n",
156 entry, retval);
157 #endif
158 out:
159 return retval;
160
161 bad_entry:
162 printk(KERN_ERR "swap_count: null entry!\n");
163 goto out;
164 bad_file:
165 printk(KERN_ERR
166 "swap_count: entry %08lx, nonexistent swap file!\n",
entry);
167 goto out;
168 bad_offset:
169 printk(KERN_ERR
170 "swap_count: entry %08lx, offset exceeds max!\n",
entry);
171 goto out;
172 bad_unused:
173 printk(KERN_ERR
174 "swap_count at %8p: entry %08lx, unused page!\n",
175 __builtin_return_address(0), entry);
176 goto out;
177 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/