patch-2.4.20 linux-2.4.20/include/linux/highmem.h
Next file: linux-2.4.20/include/linux/hil.h
Previous file: linux-2.4.20/include/linux/hiddev.h
Back to the patch index
Back to the overall index
- Lines: 66
- Date:
Thu Nov 28 15:53:15 2002
- Orig file:
linux-2.4.19/include/linux/highmem.h
- Orig date:
Fri Aug 2 17:39:45 2002
diff -urN linux-2.4.19/include/linux/highmem.h linux-2.4.20/include/linux/highmem.h
@@ -13,8 +13,7 @@
/* declarations for linux/mm/highmem.c */
unsigned int nr_free_highpages(void);
-extern struct buffer_head * create_bounce(int rw, struct buffer_head * bh_orig);
-
+extern struct buffer_head *create_bounce(int rw, struct buffer_head * bh_orig);
static inline char *bh_kmap(struct buffer_head *bh)
{
@@ -26,6 +25,42 @@
kunmap(bh->b_page);
}
+/*
+ * remember to add offset! and never ever reenable interrupts between a
+ * bh_kmap_irq and bh_kunmap_irq!!
+ */
+static inline char *bh_kmap_irq(struct buffer_head *bh, unsigned long *flags)
+{
+ unsigned long addr;
+
+ __save_flags(*flags);
+
+ /*
+ * could be low
+ */
+ if (!PageHighMem(bh->b_page))
+ return bh->b_data;
+
+ /*
+ * it's a highmem page
+ */
+ __cli();
+ addr = (unsigned long) kmap_atomic(bh->b_page, KM_BH_IRQ);
+
+ if (addr & ~PAGE_MASK)
+ BUG();
+
+ return (char *) addr + bh_offset(bh);
+}
+
+static inline void bh_kunmap_irq(char *buffer, unsigned long *flags)
+{
+ unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
+
+ kunmap_atomic((void *) ptr, KM_BH_IRQ);
+ __restore_flags(*flags);
+}
+
#else /* CONFIG_HIGHMEM */
static inline unsigned int nr_free_highpages(void) { return 0; }
@@ -37,8 +72,10 @@
#define kmap_atomic(page,idx) kmap(page)
#define kunmap_atomic(page,idx) kunmap(page)
-#define bh_kmap(bh) ((bh)->b_data)
-#define bh_kunmap(bh) do { } while (0)
+#define bh_kmap(bh) ((bh)->b_data)
+#define bh_kunmap(bh) do { } while (0)
+#define bh_kmap_irq(bh, flags) ((bh)->b_data)
+#define bh_kunmap_irq(bh, flags) do { *(flags) = 0; } while (0)
#endif /* CONFIG_HIGHMEM */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)